package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import util.DBUtil;
import bean.Alarm;
import bean.Detection;

public class chartdeo {

		public ArrayList<Detection> getChartList(String sql,String name,String date) throws SQLException {
			Connection conn = DBUtil.open();
			Statement stmt = conn.createStatement();
			ResultSet rs = null;
			ArrayList<Detection> list = new ArrayList<Detection>();

			try {
				rs = stmt.executeQuery(sql);
				while (rs.next()) {
					
					String oil_con=rs.getString(1);
					String d_name=name;
					String d_date=date;
					
					Detection dec = new Detection();
					
					dec.setOil_con(oil_con);
					dec.setD_name(d_name);
					dec.setD_date(d_date);
					list.add(dec);
				}
			} catch (Exception e) {
				System.out.println(e.getMessage());
			}finally {
				DBUtil.close();
		    }
			return list;
		}
	}

